<?php
	// Fichier de gestion/config base de données
	require "gestion_bdd.php";
?>

<?php
	try {
		// On prolonge la session
		session_start();
		// On test si la variable de session existe et contient une valeur
		if(empty($_SESSION['login'])) 
		{
			// Si inexistante ou nulle, on redirige vers le formulaire de login
			header('Location: index.php');
			exit();
		}	
	} catch (Exception $e) {
		$error = $error.$e->getMessage()."\n";
	}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
	<head>
    <meta http-equiv="Content-Type" content="text/html;  charset=UTF-8" /> 
	<title>Catégories</title> 
	<link rel="icon" type="image/png" href="images/Favicon.png" /> 
	
	<link rel="stylesheet" type="text/css" media="all" href="Styles/bootstrap.css" />
	<link rel="stylesheet" type="text/css" media="all" href="Styles/style.css" />
	
	<meta name="description" content="" /> 
	<meta name="keywords" content=""> 
	<meta name="url" content=""> 
	<meta name="robots" content="all">

	<script src="Javascripts/jquery.min.js" type="text/javascript"></script>
	<script src="Javascripts/bootstrap-alerts.js" type="text/javascript"></script>    
    <script src="Javascripts/rechercheCategories.js" type="text/javascript"></script>
	
	</head>
	<body>  
		<?php
			//Ajout du menu
			$pageActive = 2;
			include 'headMenu.php';
		?>  
  
		<div class="well" id="corps">
			<div class="page-header">
				<h2 class="center">Liste des catégories</h2>
			</div>

			<div id="boiteAlertError" class="alert-message error fade in" data-alert="alert">			
				<p id="msgError"></p>
			</div>			
			
			<form id="formRecherche" method="post">
				<div class="row">
					<div class="span11">
						<label for="inputName">Nom de la catégorie</label>
						<div class="input">
							<input type="text" name="inputName" id="inputName"/>
						</div>						
					</div>
			
					<div class="span3">
						<input class="btn primary" id="btnRecherche" type="submit" name="submit" value="Rechercher"/>
					</div>
				</div>
			</form>			
			
			<table id="tableRechercheResa" class="bordered-table">
				<thead>
					<tr>
						<th>ID_Categories</th>
						<th>Nom</th>
						<th>Description</th>
						<th>#</th>
					</tr>                    
				</thead>
				<tbody id="corpsTableRechercheResa">
					<!-- REMPLISSAGE EN AJAX -->
				</tbody>
			</table>
		</div>
	</body>
</html>